package hibernate.administratorAccount;

import hibernate.p.Unit;

public class IncomeType {
	private Unit unit;
	private Interval interval;
	public void setUnit(String name){
		if(name=="CHINESE_YUAN")
			unit=Unit.getChinese();
		else if(name=="US_DOLLAR")
			unit=Unit.getUs();
		else if(name=="EURO")
			unit=Unit.getEuro();
		else throw new java.lang.IllegalArgumentException("no this unit");
	}
	
	public String getUnit(){
		return unit.toString();
	}
	
	public void setInterval(String name){
		if (name=="MONTHLY")
			interval=Interval.getMonthly();
		else if (name=="YEARLY")
			interval=Interval.getYearly();
		else if (name=="WEEKLY")
			interval=Interval.getWeekly();
		else if (name=="DAILY")
			interval=Interval.getDaily();
		else throw new java.lang.IllegalArgumentException("no this interval");
	}
}
